<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" th:fragment="footer">
<body>


<script th:src="@{/layui/layui.js}"></script>

<link th:href="@{/layui/css/layui.css}" rel="stylesheet"/>

<div id="demo6">
    <div class="layui-box layui-laypage layui-laypage-default" id="layui-laypage-1" style="margin-left: 45%;">
        <a href="javascript:;" class="layui-laypage-first" data-page="1" title="首页" id="firstPage">首页</a>
        <a href="javascript:;" class="layui-laypage-next" data-page="6" id="prePage">上一页</a>
        <a href="javascript:;" class="layui-laypage-next" data-page="6" id="nextPage">下一页</a>
        <a href="javascript:;" class="layui-laypage-last" title="尾页" data-page="10" id="lastPage">尾页</a>
    </div>
</div>


<script>

    let totalPages = $("#totalPages").val();
    let totalElements = $("#totalElements").val();
    let size = $("#size").val();
    $("#nextPage").bind("click", function () {

        console.log('666666666 >>>>>>>>>>>>',document.cookie);
        let number = $("#number").val();
        let last = $("#last").val();
        let no = Number(number) + Number(1);
        if ("true" == last) {
            alert("已是最后一页");
            return;
        }
        let url = '/findAll?pageSize=' + size + '&pageNo=' + no;
        $('#article_type').load(url);
        // $.ajax({
        //     url: url,
        //     type: 'get',
        //     success: function (data) {
        //         $("#article_type").html(data);
        //     }
        // })
    })
    $("#prePage").bind("click", function () {
        let number = $("#number").val();
        let first = $("#first").val();
        let no = Number(number) - Number(1);
        if ("true" == first) {
            alert("已是第一页");
            return;
        }
        let url = '/findAll?pageSize=' + size + '&pageNo=' + no;
        $('#article_type').load(url);
    })
    $("#lastPage").bind("click", function () {
        let no = totalPages;
        let last = $("#last").val();
        if ("true" == last) {
            alert("已是最后一页");
            return;
        }
        if (totalPages > 1) {
            no = Number(totalPages) - Number(1);
        }
        let url = '/findAll?pageSize=' + size + '&pageNo=' + no;
        $('#article_type').load(url);
    })
    $("#firstPage").bind("click", function () {
        let first = $("#first").val();
        if ("true" == first) {
            alert("已是第一页");
            return;
        }
        let url = '/findAll?pageSize=' + size + '&pageNo=' + 0;
        $('#article_type').load(url);
    })
</script>


<footer class="footer bg-white">
    <div class="footer-social">
        <div class="footer-container clearfix">
            <div class="social-list">
            </div>
        </div>
    </div>
    <div class="footer-meta">
        <div class="footer-container">
            <div class="meta-item meta-copyright">
                <div class="meta-copyright-info">
                    <div class="info-text">
                        <a style="display: block;margin: 0 auto;" class="info-logo">
                            <img style="display: block;margin: 0 auto;" th:src="@{/user/img/bloglogo.jpg}"/>
                        </a>
                        <p style="margin: 30px">
                            <time class="comment-time"></time> &copy; Powered By <a style="color: #0e90d2"
                                                                                    rel="nofollow">CrazyStone</a></p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</footer>
<script th:src="@{/user/js/headroom.min.js}"></script>
<script th:src="@{/user/js/highlight.min.js}"></script>
<script th:src="@{/user/js/instantclick.min.js}"></script>


</body>
</html>